/*
 * @Author: wuhao930406 1148547900@qq.com
 * @Date: 2023-10-26 14:04:44
 * @LastEditors: wuhao930406 1148547900@qq.com
 * @LastEditTime: 2023-10-27 13:57:21
 * @FilePath: /eggauthmoblie/app/schedule/wx_task.js
 * @Description: t z animation.rotateZ();
 *
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
 */
'use strict';

const Subscription = require('egg').Subscription;

class GetAccessToken extends Subscription {
  // 通过 schedule 属性来设置定时任务的执行间隔等配置
  static get schedule() {
    return {
      // immediate: true,
      interval: '60m', // 5 min间隔
      type: 'all', // worker 类型：每台机器上只有一个 worker 会执行这个定时任务
    };
  }
  async subscribe() {
    const { app, service } = this;
    // await app.redis.flushall();

    await service.wx.fetchToken();
    await service.wx.getTicket();
    // await service.wx.forceToken();

  }
}

module.exports = GetAccessToken;
